package com.tanhua.server.controller;

import com.tanhua.server.service.BaiduService;
import com.tanhua.server.service.RecommendService;
import com.tanhua.server.service.SettingsService;
import com.tanhua.vo.RecommendUserQueryParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/tanhua")
public class TanhuaController {
//    GET/tanhua/todayBest

    @Autowired
    private RecommendService recommendService;

    @GetMapping(value = "/todayBest",name = "查询推荐给当前登录人缘分值最高的人")
    public ResponseEntity queryTodayBest(){
       return recommendService.queryTodayBest();
    }

    @GetMapping(value = "/recommendation",name = "查询推荐给当前登录人更多的人")
    public ResponseEntity queryRecommendation(RecommendUserQueryParam param){
        return recommendService.queryRecommendation(param);
    }




    @GetMapping(value = "/{id}/personalInfo",name = "查看佳人信息")
    public ResponseEntity queryPersonalInfo(@PathVariable("id") Long userId ){
        return recommendService.queryPersonalInfo(userId);
    }

    @GetMapping(value = "/strangerQuestions",name = "查看佳人的陌生人问题")
    public ResponseEntity queryStrangerQuestions(Long userId){
        return recommendService.queryStrangerQuestions(userId);
    }
///tanhua/strangerQuestions
    @PostMapping(value = "/strangerQuestions",name = "回复佳人的陌生人问题")
    public ResponseEntity replyStrangerQuestions(@RequestBody Map map){
        Integer userId = (Integer) map.get("userId");
        String reply = (String) map.get("reply");
        return recommendService.replyStrangerQuestions(userId,reply);
    }

    @GetMapping(value = "/cards",name = "探花-卡片显示")
    public ResponseEntity cards(){

        return recommendService.cards(20);

    }


    @GetMapping(value = "/{id}/love",name = "探花-右滑喜欢")
    public ResponseEntity love(@PathVariable("id") Long loveUserId){

        return recommendService.love(loveUserId);

    }
    @GetMapping(value = "/{id}/unlove",name = "探花-左滑不喜欢")
    public ResponseEntity unlove(@PathVariable("id") Long loveUserId){

        return recommendService.unlove(loveUserId);

    }

    @Autowired
    private BaiduService baiduService;
    @GetMapping(value = "/search",name = "搜附近的人")
    public ResponseEntity search(String gender,Integer distance){

        return baiduService.search(gender,distance);

    }


}
